<?php
defined('SYSTEM_IN') or exit('Access Denied');
?><?php
include page('header');
?>
<h3 class="header smaller lighter blue">分类列表</h3>


		<form action="" class="form-horizontal" method="post" onsubmit="return formcheck(this)">
				<table class="table table-striped table-bordered table-hover">
  <tr>
				<tr>
					<th style="width:10px;"></th>
						<th style="width:80px;">图标</th>
					<th style="width:50px;">显示顺序</th>
					<th style="width:80px;">分类名称</th>
					<th style="width:80px;">操作</th>
				</tr>
			<tbody>
			<?php
if (is_array($category)) {
    foreach ($category as $row) {
?>
				<tr>
					<td style="width:10px;"><?php
        if (count($children[$row['id']]) > 0) {
?><a href="javascript:;"><i class="icon-chevron-down"></i></a><?php
        }
?></td>
				  <td> <?php
        if (!empty($row['icon'])) {
?><i class="<?php
            echo $row['icon'];
?>"></i><?php
        }
?> </td>
					<td style="width:50px;"><input type="text"  style="width:50px"  name="displayorder[<?php
        echo $row['id'];
?>]" value="<?php
        echo $row['displayorder'];
?>"></td>
            <td>
              <?php
        echo $row['name'];
?>&nbsp;&nbsp;   	<img src="<?php
        echo WEBSITE_ROOT;
?>/attachment/<?php
        echo $row['thumb'];
?>" width='50' height="50" onerror="$(this).remove()" style='padding:1px;border: 1px solid #ccc;float:left;' />
            
            	</td>
         
					<td>
						<?php
        if (empty($row['parentid'])) {
?>
          <a class="btn btn-xs btn-info" href="<?php
            echo web_url('category', array(
                'parentid' => $row['id'],
                'op' => 'post'
            ));
?>"><i class="icon-plus-sign-alt"></i> 添加子分类</a><?php
        }
?>&nbsp;&nbsp;
					<a class="btn btn-xs btn-info" href="<?php
        echo web_url('category', array(
            'op' => 'post',
            'id' => $row['id']
        ));
?>"><i class="icon-edit"></i>&nbsp;编&nbsp;辑&nbsp;</a>&nbsp;&nbsp;
					<a class="btn btn-xs btn-info" href="<?php
        echo web_url('category', array(
            'op' => 'delete',
            'id' => $row['id']
        ));
?>" onclick="return confirm('确认删除此分类吗？');return false;"><i class="icon-edit"></i>&nbsp;删&nbsp;除&nbsp;</a></td>
				</tr>
				<?php
        if (is_array($children[$row['id']])) {
            foreach ($children[$row['id']] as $row) {
?>
				<tr>
					<td style="width:10px;"></td>
					<td>&nbsp;&nbsp;<?php
                if (!empty($row['icon'])) {
?><i class="<?php
                    echo $row['icon'];
?>"></i><?php
                }
?></td>
					<td style="width:50px;">&nbsp;&nbsp;&nbsp;<input type="text" style="width:50px" name="displayorder[<?php
                echo $row['id'];
?>]" value="<?php
                echo $row['displayorder'];
?>"></td>
					
					 <td>&nbsp;&nbsp;&nbsp;<?php
                echo $row['name'];
?>&nbsp;&nbsp; <img src="<?php
                echo WEBSITE_ROOT;
?>/attachment/<?php
                echo $row['thumb'];
?>" width='50' height="50" onerror="$(this).remove()" style='padding:1px;border: 1px solid #ccc;float:left;' /></td>
				
					<td>
					<a class="btn btn-xs btn-info" href="<?php
                echo web_url('category', array(
                    'op' => 'post',
                    'id' => $row['id'],
                    'parentid' => $row['parentid']
                ));
?>"><i class="icon-edit"></i>&nbsp;编&nbsp;辑&nbsp;</a>
					&nbsp;&nbsp;<a class="btn btn-xs btn-info" href="<?php
                echo web_url('category', array(
                    'op' => 'delete',
                    'id' => $row['id']
                ));
?>" onclick="return confirm('确认删除此分类吗？');return false;"><i class="icon-edit"></i>&nbsp;删&nbsp;除&nbsp;</a></td>
				</tr>
				<?php
            }
        }
?>
			<?php
    }
}
?>
				<tr>
					<td style="width:10px;"></td>
					<td colspan="4">
						<a href="<?php
echo web_url('category', array(
    'op' => 'post'
));
?>"><i class="icon-plus-sign-alt"></i> 添加新分类</a>
					</td>
				</tr>
				<tr>
					<td style="width:10px;"></td>
					<td colspan="4">
						<input name="submit" type="submit" class="btn btn-primary" value=" 提 交 ">
					</td>
				</tr>
			</tbody>
		</table>
		</form>
<?php
include page('footer');
?>
